/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdminWindow.java
 *
 * Created on Aug 23, 2011, 4:02:09 PM
 */
package employeemanagement;

/**
 *
 * @author pruthadesai
 */
public class AdminWindow extends javax.swing.JFrame {

    // To specify which option user has selected for form builder
    private int choice=1;
    
    /** Creates new form AdminWindow */
    public AdminWindow() {
        initComponents();
        setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        rbtnModify = new javax.swing.JRadioButton();
        rbtnCreate = new javax.swing.JRadioButton();
        rbtnDelete = new javax.swing.JRadioButton();
        rbtnSummary = new javax.swing.JRadioButton();
        btnOK = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DesignPatterns Inc.", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Gabriola", 0, 24))); // NOI18N

        rbtnModify.setText("Modify an Existing Record");
        rbtnModify.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnModifyActionPerformed(evt);
            }
        });

        rbtnCreate.setSelected(true);
        rbtnCreate.setText("Create an Employee Record");
        rbtnCreate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnCreateActionPerformed(evt);
            }
        });

        rbtnDelete.setText("Delete an existing Record");
        rbtnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnDeleteActionPerformed(evt);
            }
        });

        rbtnSummary.setText("Summary of Employees");
        rbtnSummary.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rbtnSummaryActionPerformed(evt);
            }
        });

        btnOK.setText("OK");
        btnOK.setToolTipText("Click here to display form.");
        btnOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOKActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(38, 38, 38)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(btnOK)
                    .add(rbtnSummary)
                    .add(rbtnDelete, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 193, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(rbtnCreate)
                    .add(rbtnModify))
                .addContainerGap(336, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(rbtnCreate)
                .add(31, 31, 31)
                .add(rbtnModify)
                .add(28, 28, 28)
                .add(rbtnDelete)
                .add(29, 29, 29)
                .add(rbtnSummary)
                .add(27, 27, 27)
                .add(btnOK)
                .addContainerGap(241, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void rbtnModifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnModifyActionPerformed
    System.out.println("Modify Record");
    choice = 2;
}//GEN-LAST:event_rbtnModifyActionPerformed

private void rbtnSummaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnSummaryActionPerformed
    System.out.println("Summary Records");
    choice = 4;
}//GEN-LAST:event_rbtnSummaryActionPerformed

private void rbtnCreateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnCreateActionPerformed
    System.out.println("Create Record");
    choice = 1;
}//GEN-LAST:event_rbtnCreateActionPerformed

private void rbtnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbtnDeleteActionPerformed
    System.out.println("Delete Record");
    choice = 3;
}//GEN-LAST:event_rbtnDeleteActionPerformed

private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
    System.out.println("FormBuilder object created");
    
    setVisible(false);
    FormBuilder fb = new FormBuilder(choice);
}//GEN-LAST:event_btnOKActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(AdminWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(AdminWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(AdminWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(AdminWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new AdminWindow().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnOK;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JRadioButton rbtnCreate;
    private javax.swing.JRadioButton rbtnDelete;
    private javax.swing.JRadioButton rbtnModify;
    private javax.swing.JRadioButton rbtnSummary;
    // End of variables declaration//GEN-END:variables
}
